﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

public partial class YJLR_YJCXList_KH : System.Web.UI.Page
{
  protected void Page_Load(object sender, EventArgs e)
  {
    if (!ProjectPrivate.GetQX("19"))
    {
      Server.Transfer("~\\blank.aspx");
    }
    if (!Page.IsPostBack)
    {
      //date1.Text = CommonUse.GetYC();
      //date2.Text = CommonUse.GetYM();
      if (CommonUse.GetID("mode") == "")
      {
        ASPxGridView1.Columns[ASPxGridView1.Columns.Count - 1].Visible = false;
        ASPxGridView1.Columns[ASPxGridView1.Columns.Count - 2].Visible = false;
        HyperLink1.NavigateUrl = "YJCXList.aspx";
      }
      else
      {
        HyperLink1.NavigateUrl = "YJLRList.aspx";
      }
    }
    BindGrid();
  }

  protected void BindGrid()
  {
    DataSet ds = YJLR.GetDS_KH(CommonUse.GetID("khid"),"");
    ASPxGridView1.DataSource = ds;
    ASPxGridView1.DataBind();
  }

  protected void lbDelete_Command(object sender, CommandEventArgs e)
  {
    List<CommandInfo> cis = new List<CommandInfo>();
    cis.Add(CommonUse.DeleteCI("sjlr_yjlr", "yjid", e.CommandArgument.ToString()));

    if (DbHelperSQL.ExecuteSqlTran(cis) > 0)
    {
      BindGrid();
    }
  }
  protected void btnQuery_Click(object sender, EventArgs e)
  {

  }

  protected void btnExport_Click(object sender, EventArgs e)
  {
    this.ASPxGridViewExporter1.WriteXlsToResponse();
  }
}